<template>
  <c-select
    v-bind="$attrs"
    v-on="$listeners"
    filterable
    :value="value"
    :options="orgList"
    @change="hangleChange"
    :props="props"
  ></c-select>
</template>

<script>
export default {
  components: {},
  props: {
    value: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      props: {
        value: 'orgClass',
        label: 'orgClassName',
      },
    }
  },
  computed: {
    orgList() {
      return this.$store.getters.enumOrgClass.filter(item => item.orgClass !== 'org_person')
    },
  },
  watch: {},
  created() {
    this.$store.dispatch('getEnumOrgClass')
  },
  mounted() {},
  methods: {
    hangleChange(val = '') {
      const item = this.orgList.find(item => item.orgClass === val) || {}
      this.$emit('input', val)
      this.$emit('change', val)
      this.$emit('select', item.orgClassName || '', item)
    },
  },
}
</script>

<style scoped></style>
